FROM microsoft/dotnet:2.1-aspnetcore-runtime AS base
RUN ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime    
RUN echo "Asia/Shanghai" > /etc/timezone    
RUN dpkg-reconfigure -f noninteractive tzdata
WORKDIR /app
	
FROM microsoft/dotnet:2.1-sdk AS build
WORKDIR /src
COPY ApiGateway/ApiGateway.csproj ApiGateway/
COPY Gmmy.Utility/Gmmy.Utility.csproj Gmmy.Utility/
RUN dotnet restore ApiGateway/ApiGateway.csproj  -s http://dev.rhpass.com:7000/nuget -s https://nuget.cdn.azure.cn/v3/index.json
COPY . .
WORKDIR /src/ApiGateway
RUN dotnet build ApiGateway.csproj -c Release -o /app

FROM build AS publish
RUN dotnet publish ApiGateway.csproj -c Release -o /app

FROM base AS final
WORKDIR /app
COPY --from=publish /app .
ENTRYPOINT ["dotnet", "ApiGateway.dll"]
